package site.wenneng.dev.service;

import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import site.wenneng.dev.common.enumeration.DicEnum;
import site.wenneng.dev.objs.po.DevUserPO;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

@Service
@AllArgsConstructor
public class DevUserService {

    private DictionaryService dictionaryService;

    public List<DevUserPO> findAll() {
        return dictionaryService.listDic(DicEnum.DEV_USER).stream().map(item -> {
            DevUserPO devUser = new DevUserPO();
            devUser.setAssigneeId(item.getDictValue());
            devUser.setAssigneeName(item.getDictLabel());
            return devUser;
        }).collect(Collectors.toList());
    }

    public List<String> getAllAssigneeId() {
        return findAll().stream().map(DevUserPO::getAssigneeId).collect(Collectors.toList());
    }
}
